home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Champak 50
/
Volume 50 - JOGO DISK .iso
/
Games
/
moonstonemadness.swf
/
scripts
/
__Packages
/
EditorCenterPanMachine.as
< prev
next >
Wrap
Text File
|
2007-09-27
|
4KB
|
151 lines
class EditorCenterPanMachine extends Library.State
{
function EditorCenterPanMachine(__mcRef, __oParentMachine)
{
super(__mcRef);
this.oParentMachine = __oParentMachine;
Main.__get__Instance().doAddListener(this);
}
function setNumber(__nNumber)
{
this.nNumber = __nNumber;
this.doChangeNumber();
this.doSetUpIdle();
}
function setRef(__mcRef)
{
this.mcRef = __mcRef;
this.sState = "___RESET___";
this.setState("Idle");
}
function doScrollUp()
{
this.setState("Raise");
}
function doScrollDown()
{
this.setState("Lower");
}
function doRefreshVisual()
{
this.doLoadStateAction();
}
function doDestroy()
{
Main.__get__Instance().doRemoveListener(this);
}
function doRaise()
{
if(this.isStateComplete())
{
this.setState("Idle");
}
}
function doLower()
{
if(this.isStateComplete())
{
this.setState("Idle");
}
}
function doLoadStateAction()
{
super.doLoadStateAction();
switch(this.__get__CurrentState())
{
case "Idle":
this.doSetUpIdle();
LevelEditor.__get__Instance().onMoveStop();
break;
case "Raise":
this.doSetUpRaise();
break;
case "Lower":
this.doSetUpLower();
}
this.doChangeNumber();
}
function doChangeNumber()
{
var _loc7_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
var _loc2_ = LevelEditor.__get__Instance().getNumberForPanel(_loc7_);
var _loc3_ = 0;
switch(this.__get__CurrentState())
{
case "Idle":
_loc3_ = 0;
break;
case "Raise":
_loc3_ = -1;
break;
case "Lower":
_loc3_ = 1;
}
_loc2_ += _loc3_;
if(_loc2_ > LevelEditor.LETTERS.length - 1)
{
_loc2_ = 0;
}
else if(_loc2_ < 0)
{
_loc2_ = LevelEditor.LETTERS.length - 1;
}
var _loc5_ = _loc2_ - 1;
var _loc6_ = _loc2_;
var _loc4_ = _loc2_ + 1;
if(_loc5_ < 0)
{
_loc5_ = LevelEditor.LETTERS.length - 1;
}
if(_loc4_ > LevelEditor.LETTERS.length - 1)
{
_loc4_ = 0;
}
var _loc10_ = LevelEditor.LETTERS[_loc5_];
var _loc9_ = LevelEditor.LETTERS[_loc6_];
var _loc8_ = LevelEditor.LETTERS[_loc4_];
this.mcRef.mcState.mcBoxTop.mcNumber.txtNumber.text = _loc10_;
this.mcRef.mcState.mcBoxCenter.mcNumber.txtNumber.text = _loc9_;
this.mcRef.mcState.mcBoxBottom.mcNumber.txtNumber.text = _loc8_;
}
function doSetUpIdle()
{
var _loc2_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
this.oParentMachine.setVisualForBox(_loc2_,this.mcRef.mcState.mcBoxCenter);
}
function doSetUpLower()
{
var _loc3_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
var _loc4_ = LevelEditor.__get__Instance().getNumberForPanel(_loc3_);
var _loc2_ = _loc4_ + 1;
if(_loc2_ > LevelEditor.LETTERS.length - 1)
{
_loc2_ = 0;
}
else if(_loc2_ < 0)
{
_loc2_ = LevelEditor.LETTERS.length - 1;
}
var _loc5_ = LevelEditor.__get__Instance().getPanelLinkage(_loc2_) + LevelEditor.__get__Instance().getCurrentSuffix();
this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxTop);
this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
}
function doSetUpRaise()
{
var _loc3_ = LevelEditor.__get__Instance().getLinkageFor(this.nNumber);
var _loc4_ = LevelEditor.__get__Instance().getNumberForPanel(_loc3_);
var _loc2_ = _loc4_ - 1;
if(_loc2_ > LevelEditor.LETTERS.length - 1)
{
_loc2_ = 0;
}
else if(_loc2_ < 0)
{
_loc2_ = LevelEditor.LETTERS.length - 1;
}
var _loc5_ = LevelEditor.__get__Instance().getPanelLinkage(_loc2_) + LevelEditor.__get__Instance().getCurrentSuffix();
this.oParentMachine.setVisualForBox(_loc3_,this.mcRef.mcState.mcBoxBottom);
this.oParentMachine.setVisualForBox(_loc5_,this.mcRef.mcState.mcBoxCenter);
}
}